package com.lzx.resumeweb.api;

import com.lzx.resumebase.model.Result;
import com.lzx.resumebase.model.Work;
import com.lzx.resumebase.util.ResultUtil;
import com.lzx.resumeservice.service.WorkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName WorkApi
 * @Author 刘正星
 * @Date 2021/5/30 上午10:26
 * @Description
 */
@RestController
@RequestMapping("/work")
public class WorkApi {

    @Autowired
    private WorkService workService;

    @GetMapping("/getByUserId/{userId}")
    public Result getByUserId(@PathVariable("userId") String userId){

        if (!StringUtils.hasText(userId)){
            return ResultUtil.paramError();
        }
        return ResultUtil.success(workService.lambdaQuery().eq(Work::getUserid,userId).list());
    }

}
